# ArchLinux:
# Maintainer: Alexander Duscheleit <jinks@archlinux.us>
# MSYS2:
# Maintainer: Ray Donnelly <mingw.android@gmail.com>

_pyname=colorama
pkgbase="python-${_pyname}"
pkgname=(python2-${_pyname} python3-${_pyname})
pkgver=0.3.9
pkgrel=2
pkgdesc="Python API for cross-platform colored terminal text."
arch=('any')
url="https://pypi.python.org/pypi/colorama"
license=('BSD')
makedepends=('python2' 'python3' 'git')
checkdepends=('python3-mock' 'python2-mock')
source=(https://pypi.python.org/packages/source/c/colorama/colorama-${pkgver}.tar.gz)
sha256sums=('48eb22f4f8461b1df5734a074b57042430fb06e1d61bd1e11b078c0fe6d7a1f1')


prepare() {
  for pver in {3,2}; do
    rm -rf python${pver} || true
    cp -r ${_pyname}-${pkgver} python${pver}
  done
}

build() {
  for pver in {3,2}; do
    cd "$srcdir/python${pver}"
    /usr/bin/python${pver} setup.py build
  done
}

check() {
  for pver in {3,2}; do
    msg "Python ${pver} test"
    cd "${srcdir}/python${pver}"
    /usr/bin/python${pver}.exe -m unittest discover -p *_test.py || warning "test failed"
  done
}

package_python2-colorama() {
  depends=('python2')

  cd ${srcdir}/python2
  /usr/bin/python2 setup.py install --root="${pkgdir}" --optimize=1
  install -D -m644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"
}

package_python3-colorama() {
  depends=('python3')

  cd ${srcdir}/python3
  /usr/bin/python3 setup.py install --root="${pkgdir}" --optimize=1
  install -D -m644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"
}

# vim:set ts=2 sw=2 et:
